<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">演示</a>
                <a>
                    <cite>导航元素</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>
<div >
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <!--class="layui-form layui-col-space5" id="userSearch"-->
                    <form  class="layui-form layui-form-pane" method="post" action="">
                        <div class="layui-inline layui-show-xs-block">
                            <input class="layui-input" autocomplete="off" placeholder="开始日" name="start" id="start"></div>
                        <div class="layui-inline layui-show-xs-block">
                            <input class="layui-input" autocomplete="off" placeholder="截止日" name="end" id="end"></div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="empName" placeholder="请输入用户名" autocomplete="off" class="layui-input"></div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn" lay-submit="" lay-filter="searchSubmit">
                                <i class="layui-icon">&#xe615;</i></button>
                        </div>
                    </form>
                </div>
                <table class="layui-table" id="valueTable" lay-filter="studentManage">

                </table>

                <script type="text/html" id="toolbar">
                    <xblock>
                        <a class="layui-btn layui-btn-mini" href="dept-list.html">返回</a>
                    </xblock>
                </script>
                <script type="text/html" id="barDemo">
                    <a class="layui-btn layui-btn-mini layui-btn-normal" lay-event="del">恢复</a>
                </script>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container" >
        <button class = "layui-btn layui-btn-sm" lay-event = "getCheckData" > 获取选中行数据 </button>
        <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button >
        <button class = "layui-btn layui-btn-sm" lay-event = "isAll" > 验证是否全选</button>
    </div >
</script>
<script type="text/html" id="switchTpl">
    <!-- 这里的checked的状态只是演示 -->
    <input type = "checkbox" name = "sex" value = "{{d.id}}" lay-skin = "switch"lay-text = "女|男" lay-filter = "sexDemo" {{ d.id == 10003 ? 'checked': ''}} >
</script>
<script>
    var form;
    var table;
    layui.use('table', function () {
        table = layui.table, form = layui.form;
        table.render({
            elem: '#valueTable'  //要和table标签ID一致
            //,height: 'full'
            , url: '/emp/dept/selectByDel'
            , id: 'testReload'
            , toolbar:'#toolbar'
            , page: true
            , limit: 10
            // , offset: 'auto'
            // , height: 'full-105'
            ,loading: true
            ,cols: [[
                {type:'numbers',title:'序号',align:'center', width:40} // 自增序号
                ,{field: 'deptId', title: '部门ID', align: 'center', width: 40}
                , {field: 'deptName', title:'部门',width: 150, align: 'center'}
                , {field: 'createTime', title: '创建时间', align: 'center', width: 370}
                , {field: 'updateTime', title: '修改时间', align: 'center', width: 370}
                ,{fixed: 'right', width: 150, align: 'center', toolbar: '#barDemo', title: '操作'}
            ]]
            , done: function (res, curr, count) {
                console.log(res.data);
            }
        });

        table.on('tool(studentManage)', function(obj){
            var data = obj.data;
            if(obj.event === 'detail'){
                layer.msg('ID：'+ data.id + ' 的查看操作');
            } else if(obj.event === 'del'){
                layer.confirm('确定恢复吗', function(index){
                    console.log(data);
                    $.ajax({
                        url: "/emp/dept/recover/"+data.deptId,
                        type: "DELETE",
                        success: function(data){
                            if(data.state==1){
                                obj.del();
                                layer.close(index);
                                layer.msg("恢复成功", {icon: 6});
                            }else{
                                layer.msg("恢复失败", {icon: 5});
                            }
                        }

                    });
                });
            }
        });
        table.on('toolbar(studentManage)', function(obj){
            var data = obj.data;
            if (obj.event === 'add'){
                addStudent(data)
            }
        });
    });
</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>

</html>